import { $loveList } from "api";
import React, { useEffect, useState } from "react";
import "./love.less";

function Love() {
  // 定义状态
  let [list, setList] = useState([]);
  // 定义获取列表数据的方法
  let getList = () => {
    $loveList().then((res) => {
      console.log(res);
      setList(res.result);
    });
  };
  // 一开始就去获取数据
  useEffect(getList, []);

  return (
    <div className="my-love">
      {list.map((item) => (
        <li key={item.id} className="item pl-10 pr-10 bg-fff flex jc-sb aic">
          <img
            src={item.imageUrl}
            alt=""
          />
          <div className="t-box fg1 ml-15 f14 pt-15 fdc jc-c">
            <p className="bold lh15">大鹏古城·​千语居7房客栈</p>
            <p className="mt-10">
              <span>¥3288 </span>
              <span className="f888 ml-5">人均:219</span>
            </p>
          </div>
        </li>
      ))}
    </div>
  );
}

export default Love;
